package com.changgou;


import com.changgou.common.interceptor.FeignRequestInterceptor;
import com.changgou.common.util.IdWorker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@EnableEurekaClient
@MapperScan(basePackages = "com.changgou.order.dao")
@EnableFeignClients({"com.changgou.goods.feign","com.changgou.user.feign"})
public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    /**
     * 注册Feign请求拦截器，：携带头部信息到下一个微服务
     * @return
     */
   @Bean
   public FeignRequestInterceptor requestInterceptor(){
       return new FeignRequestInterceptor();
   }

    @Bean
    public IdWorker idWorker(){
        return new IdWorker();
    }
}
